<template>
    <div>
        <el-button type="primary" icon="el-icon-edit" circle @click="useradd"></el-button>
      <el-table :data="userlist">
  	<el-table-column type="selection" width="150"></el-table-column>
    <el-table-column property="id" label="id" width="150"></el-table-column>
    <el-table-column property="name" label="姓名" width="200"></el-table-column>
    <el-table-column property="phone" label="手机号" width="200"></el-table-column>
    <el-table-column property="address" label="地址" width="200"></el-table-column>
    <el-table-column property="userface" label="图片" width="200">
      <template slot-scope="beans">
            <img :src="beans.row.userface" style="width: 70px;height: 50px;" alt="yyy" />
          </template>
    </el-table-column>
    <el-table-column  label="操作">
      <el-row slot-scope="scope">
      	<el-button type="primary" >删除</el-button>
      	<el-button type="primary" >修改</el-button>
      </el-row>
    </el-table-column>
  </el-table>
    
        <div style="margin-top: 20px">
        </div>
      <!-- <el-pagination
      @current-change="users"
      :current-page="pagination.pages+1"
      :page-count="pagination.total"
       >
    </el-pagination> -->
     <el-pagination @current-change="userlist" background :total="pageList.total*3-10"></el-pagination>

    </div>
</template>
<style>
.home-container {
  height: 100%;
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
}
.home-header {
  background-color: #20a0ff;
  color: #333;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: content-box;
  padding: 15px;
}
.home_title {
  color: #fff;
  font-size: 22px;
  display: inline;
  margin-left: 8px;
}
.home-aside {
  background-color: #ececec;
}
</style>


<!-- 分界线 -->
<script>
import axios from "axios";
var zhu = {
  userlist: [],
  handleSelectionChange: "12px",
  url:"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
  pageList: {}


};
export default {
  name: "list",
  props: {
    msg: String
  },
  data() {
    return zhu;
  },
  mounted: function() {
    var d = this;
    this.users(1, 3);
  },
  methods: {
    users: function(pagenum, size) {
      var k = this;
      this.$ajax({
         
        url:
          "http://localhost:8081/user/page?pageNum=" +
          pagenum +
          "&pageSize=" +
          size
      }).then(function(s) {
        k.userlist = s.data.object.records;
        k.pagelist = s.data.object;
        alert(k.userlist);
      });
      console.log(k.userlist);
    },
    useradd:function(){
        this.$router.replace({path: '/UserAdd'});
    }
  }
};
</script>

